home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS Toolkit
/
BBS Toolkit.iso
/
pc_board
/
callid1.zip
/
CALLERID.PPS
< prev
next >
Wrap
Text File
|
1993-04-06
|
5KB
|
163 lines
; *****************************************************************
; * *
; * CALLERID V 1 . 0 *
; * *
; * Written in PPL for PCBoard *
; * *
; * Designed By: Gary Meeker *
; * *
; * Began development: 04-06-93 *
; * *
; *****************************************************************
;
; This .PPE checks the secrity level of a user and if within the specified
; range, checks the Caller ID info for the phone number. If a number is
; found, then it writes it to the file specified.
;
; Usage:
;
; !Verify.PPE SecLow;SecHigh;IDType;CIDFile;PrivateFile;OutsideFile;NoMatchFile
;
; Where:
; SecLow is the lowest level to display the file to
; SecHigh is the highest level to display the file to
; IDType is the type of Caller ID info or Position of the PhoneNumber+11
; Predefined formats are 1-10
; 1 = Supra - scan for "NMBR = " 6
; 2 7
; 3 8
; 4 9
; 5 10
; CIDFile is the caller ID file to create
; PrivateFile is the file to be displayed if the ID indicates Private
; OutsideFile is the file to be displayed if the ID indicates Outside Area
; NoMatchFile is the file to be displayed if the ID does not match Users Record
;
STRING CID, CIDFile, PrivateFile, NoMatchFile, OutSideFile
STRING Private, Outside, Digits
STRING HVPHONE, BDPHONE, PhoneNumber, Filter
INTEGER SecLow, SecHigh, IDType, Pos, OffSet, X
;Assume a "P" indicates a PRIVATE number and "O" indicates a OUTSIDE AREA number
Private = "P"
Outside = "O"
;Characters to Filter out of Users Record Phone Numbers
Filter = " -()+"
;Parse the command line
GETTOKEN SecLow
GETTOKEN SecHigh
GETTOKEN IDType
GETTOKEN CIDFile
GETTOKEN PrivateFile
GETTOKEN NoMatchFile
;Delete any existing CIDFile first if one was specified
IF (CIDFile<>"") THEN
IF (EXIST(CIDFile)) THEN
DELETE CIDFile
END IF
END IF
;Get the Caller ID string and the Users info so we can get to U_SEC and such
CID = CALLID()
GETUSER
;Bail out if not within the desiredSecurity range or no Caller ID info
IF (U_Sec < SecLow | U_Sec > SecHigh | CID = "") STOP
;Get HVPhone number and strip out other characters.
IF (NoMatchFile<>"") THEN
HVPHONE = U_HVPHONE
FOR X = 1 TO LEN(Filter)
HVPHONE = STRIP(HVPHONE,MID(Filter,X,1))
NEXT X
IF (LEFT(HVPHONE,1)="1") THEN
HVPHONE=MID(HVPHONE,2,LEN(HVPHONE)-1)
END IF
IF (HVPHONE="") LET HVPHONE="0000000000"
;Get BDPhone number and strip out other characters.
BDPHONE = U_BDPHONE
FOR X = 1 TO LEN(Filter)
BDPHONE=STRIP(BDPHONE,MID(Filter,X,1))
NEXT X
IF (LEFT(BDPHONE,1)="1") THEN
BDPHONE=MID(BDPHONE,2,LEN(BDPHONE)-1)
END IF
IF (BDPHONE="") LET BDPHONE="00000000000"
END IF
;Find the postion of the Phone Number in the Caller ID string
IF (IDType = 1) THEN
Pos = INSTR(CID,"NMBR = ")
Offset = 7
; Private = "P"
; Outside = "O"
ELSEIF (IDType > 11) THEN
Pos = IDType
Offset = -11
ELSE
PRINTLN "I don't know that IDType (";IDType;")"
STOP
END IF
;Bail out if we didn't find it
IF (Pos = 0) STOP
;Pull out just the Phone Number
PhoneNumber = UPPER(TRIM(MID(CID,Pos+Offset,10)," "))
;If it's PRIVATE then show the file if specified
IF (LEFT(PhoneNumber,1)=Private & PrivateFile<>"") THEN
IF (EXIST(PrivateFile)) THEN
DISPFILE PrivateFile, LANG+SEC+GRAPH
END IF
;If it's OUTSIDE AREA then show the file if specified
ELSEIF (LEFT(PhoneNumber,1)=Outside & OutsideFile<>"") THEN
IF (EXIST(OutsideFile)) THEN
DISPFILE OutsideFile, LANG+SEC+GRAPH
END IF
;If it's not Home/Voice or Business/Data then show the file if specified
ELSEIF (NoMatchFile<>"" & RIGHT(PhoneNumber,LEN(HVPHONE))<>HVPHONE & RIGHT(PhoneNumber,LEN(BDPHONE))<>BDPHONE) THEN
IF (EXIST(NoMatchFile)) THEN
DISPFILE NoMatchFile, LANG+SEC+GRAPH
END IF
END IF
;Verify all digits and a full 10 of them at that
Digits = "1234567890"
IF (LEN(PhoneNumber) < 10) STOP
FOR Pos = 1 TO 10
IF (INSTR(Digits, MID(PhoneNumber,Pos,1))=0) STOP
NEXT Pos
;Write the number as AAA-EEE-NNNN to the desired file if specifed
IF (CIDFile<>"") THEN
FOPEN 1,CIDFile,O_WR,S_DB
FPUTLN 1,LEFT(PhoneNumber,3),"-",MID(PhoneNumber,4,3),"-",RIGHT(PhoneNumber,4)
FCLOSE 1
END IF
END